package com.logisticsmanagement.normal_user;

import com.logisticsmanagement.R;

import android.os.Bundle;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
/**
 * 普通用户职能类
 * @author 陈朝辉
 * @createTime 2015年3月17日 下午4:47:28
 * @version 1.0
 */
public class NormalUserActivity extends Activity implements OnClickListener{

	private FragmentManager fragmentManager;
	Ordering ordering;
	Research research;
	private TextView tvOrdering;
	private TextView tvResearch;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_normal_user);
		
		tvOrdering = (TextView)findViewById(R.id.tvOrderingIndent);
		tvResearch = (TextView)findViewById(R.id.tvResearchIndent);
		
		tvOrdering.setOnClickListener(this);
		tvResearch.setOnClickListener(this);
		
		fragmentManager = getFragmentManager();
		ordering = new Ordering();
		research = new Research();
		
		//设置默认的fragment
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.replace(R.id.fl_normal_user, ordering).commit();
		
	}

	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		switch(view.getId()){
		case R.id.tvOrderingIndent:
			fragmentTransaction.replace(R.id.fl_normal_user, ordering).commit();
			break;
		case R.id.tvResearchIndent:
			fragmentTransaction.replace(R.id.fl_normal_user, research).commit();
			break;
		}
	}

	

}
